mod chat_command;
mod db_init;
mod db_type;
mod media;
mod tcp_stream;

// Learn more about Tauri commands at https://tauri.app/develop/calling-rust/
use chat_command::{add_friend, connect, friend_list, query_messages, save_messages,screenshot};
use db_init::initialize_databases;

#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
    tauri::Builder::default()
        .setup(|app| {
            initialize_databases(app.handle());
            Ok(())
        })
        .plugin(tauri_plugin_http::init())
        //.plugin(tauri_plugin_websocket::init())
        .plugin(tauri_plugin_opener::init())
        .plugin(tauri_plugin_clipboard_manager::init())
        .invoke_handler(tauri::generate_handler![
            connect,
            friend_list,
            add_friend,
            save_messages,
            query_messages,
            screenshot
        ])
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}
